package com.kitty.mina;

import com.kitty.game.utils.JsonUtils;
import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/**
 * ModuleCounter 发包计次
 *
 * @author StanWind
 * @create 2020 - 05 - 16 1:38 AM
 */
public class ModuleCounter implements Serializable {

    /**
     * 当前session是否已经检测过合法
     */
    private boolean checked;

    /**
     * 登录时间
     */
    private long loginTime;

    /**
     * 上次包时间
     */
    private long lastPackTime;

    /**
     * 发包数量计次
     */
    private AtomicLong count = new AtomicLong(0);

    /**
     * 模块发包计次
     */
    private Map<Integer, AtomicInteger> counterMap = new ConcurrentHashMap<>();

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    public long getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(long loginTime) {
        this.loginTime = loginTime;
    }

    public long getLastPackTime() {
        return lastPackTime;
    }

    public void setLastPackTime(long lastPackTime) {
        this.lastPackTime = lastPackTime;
    }

    public Map<Integer, AtomicInteger> getCounterMap() {
        return counterMap;
    }

    public void setCounterMap(Map<Integer, AtomicInteger> counterMap) {
        this.counterMap = counterMap;
    }

    public AtomicLong getCount() {
        return count;
    }

    public void setCount(AtomicLong count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return JsonUtils.object2String(this);
    }
}
